package thread;
class TestThread extends Thread{
	public TestThread(String name){
		super(name);
	}
	public TestThread(ThreadGroup group,String name){
		super(group,name);
	}
	public void run(){
		for (int i = 0; i < 20; i++) {
			System.out.println(getName()+"线程变量i"+i);
		}
	}
	
}

class GroupTest{
	public static void main(String[] args) {
		ThreadGroup maingroup=Thread.currentThread().getThreadGroup();
		System.out.println("当前线程组名"+maingroup);
		System.out.println("住线程组是否有后台线程组"+maingroup.isDaemon());
		new TestThread("主线程组线程").start();
		ThreadGroup tg=new ThreadGroup("新线程组");
		tg.setDaemon(true);
		System.out.println("tg线程组是否是后台线程组："+tg.isDaemon());
		TestThread tt=new TestThread(tg, "tg组线程甲");
		tt.start();
		System.out.println(tt.isDaemon());;
		new TestThread(tg,"tg组线程乙").start();
		
	}
}